<!-- 吐司提示 -->
<!--BEGIN toast-->
<div id="toast" style="display: none;">
    <div class="weui-mask_transparent"></div>
    <div class="weui-toast">
        <i class="weui-icon-success-no-circle weui-icon_toast"></i>
        <p class="weui-toast__content">已完成</p>
    </div>
</div>

<!--BEGIN toast-->
<div id="warnToast" style="display: none;">
    <div class="weui-mask_transparent"></div>
    <div class="weui-toast">
        <i class="weui-icon-warn weui-icon_toast"></i>
        <p class="weui-toast__content">获取链接失败</p>
    </div>
</div>

<!-- loading toast -->
<div id="loadingToast" style="display: none;">
    <div class="weui-mask_transparent"></div>
    <div class="weui-toast">
        <span class="weui-primary-loading weui-primary-loading_transparent weui-icon_toast">
            <span class="weui-primary-loading__dot"></span>
        </span>
        <p class="weui-toast__content">加载中</p>
    </div>
</div>

<!-- text toast -->
<div id="textToast" style="display: none;">
    <div class="weui-mask_transparent"></div>
    <div class="weui-toast weui-toast_text">
        <p class="weui-toast__content">文字提示</p>
    </div>
</div>


<script type="text/javascript">
    // text
    function showTxtToast(text) {
        var $textToast = $('#textToast');
        $('.weui-toast__content').text(text);
        if ($textToast.css('display') != 'none') return;

        $textToast.fadeIn(100);
        setTimeout(function () {
            $textToast.fadeOut(100);
        }, 2000);
    }

    function showWarnToast(text) {
        var $warnToast = $('#warnToast');
        $('.weui-toast__content').text(text);
        if ($warnToast.css('display') != 'none') return;
        $warnToast.fadeIn(100);
        setTimeout(function () {
            $warnToast.fadeOut(100);
        }, 1500);
    }

    function showOKToast() {
        var $toast = $('#toast');
        if ($toast.css('display') != 'none') return;
        $toast.fadeIn(100);
        setTimeout(function () {
            $toast.fadeOut(100);
        }, 1500);

    }

    // loading
    function showLoading(text) {
        var $loadingToast = $('#loadingToast');
        $('.weui-toast__content').text(text);
        if ($loadingToast.css('display') != 'none') return;
        $loadingToast.fadeIn(100);
    }

    function dissmisLoading() {
        var $loadingToast = $('#loadingToast');
        $loadingToast.fadeOut(100);
    }
</script>